''''
list1 = ['Google', 'Runoob', 1997, 2000]
list2 = [1, 2, 3, 4, 5 ]
list3 = ["a", "b", "c", "d"]

print (list1)
print (list2)
print (list3)
'''

#访问列表中的值
list1 = ['Google', 'Runoob', 1997, 2000]
list2 = [1, 2, 3, 4, 5, 6, 7 ]
 
print ("list1[0]: ", list1[0])
print ("list2[1:5]: ", list2[1:5])


#更新列表
list = ['Google', 'Runoob', 1997, 2000]

print ("第三个元素为 : ", list[2])
list[2] = 2001#赋值
print ("更新后的第三个元素为 : ", list[2])

#删除列表元素
list = ['Google', 'Runoob', 1997, 2000]
 
print (list)
del list[2]
print ("删除第三个元素 : ", list)

#Python列表脚本操作符
#获取长度
print (len([1, 2, 3]))

#合并数组
print ([1, 2, 3] + [4, 5, 6])

#数组中是否包含元素
print (3 in [1, 2, 3])

#遍历数组
for x in [1, 2, 3]: 
    print(x)

#Python列表截取与拼接
L=['Google', 'Runoob', 'Taobao']    
print (L[2]) #访问元素3
print (L[-2])#访问倒数第二个
print (L[1:])#访问索引1向后的元素
